import requests
import re


# 请求网站,正则截取图片信息
def request_img(url):
    response = requests.get(url=url)
    img_lst = re.findall(r"(?<=<img src=).*(?= width=)", response.text)
    return img_lst


# 请求图片地址，并保存
def img_save(url, img_url):
    img = requests.get(url=url+img_url)
    with open(f'img/{img_url}', 'wb+') as fp:
        fp.write(img.content)


url = "https://www.sanchuangedu.cn/"
img_lst = request_img(url)
print(img_lst)
for img_url in img_lst:
    img_save(url, img_url)